home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Night Owl 6
/
Night Owl's Shareware - PDSI-006 - Night Owl Corp (1990).iso
/
038a
/
qbrv1_2.zip
/
QBRENUM.DOC
< prev
next >
Wrap
Text File
|
1991-11-20
|
30KB
|
958 lines
================================================================
T H E Q U I C K B A S I C R E N U M B E R
U T I L I T Y
U S E R ' S M A N U A L
by Richard Z. Ward
Version 1.2
PC/MS-DOS 2.0 or Later
(C) Copyright 1988-1991 by Richard Z. Ward, All Rights Reserved
================================================================
L I C E N S E A G R E E M E N T ------------------------------
--------- A Limited License
A limited license is granted to all users of the program to make
copies of the program and the accompanying documentation and to
distribute them to other users under the following restrictions:
1. Neither a fee nor any other consideration may be charged for
copying or distributing the program without the express written
permission from Richard Z. Ward.
2. The program and its documentation may not be distributed in
modified forms.
--------- Shareware Registration
The Quick BASIC Renumber Utility is the result of many hours of
work. If you find it useful, please register your copy of the
program. To register, fill out a hard copy of the ORDERFRM.DOC
file, write a check for $12.50 to Richard Z. Ward, and send the
form and check to the following address:
Richard Z. Ward / WARDCO
P.O. Box 454
Belmont, MA 02178
You will then receive a newly serialized copy of the program and
a complete set of printed instructions. As a registered user,
you will be notified of all future updates to the program; the
first update from the version you registered will be sent to you
at no charge.
--------- User Support and Defects and Enhancements
If you have any suggestions for future versions of the Quick
BASIC Renumber Utility or find any defects in the existing
version, please fill out a hard copy of the DEFECTS.DOC file and
send the form to the above address.
Otherwise, If you are having trouble using the program, please
send your written questions to the above address.
The Quick BASIC Renumber Utility Page 2
--------- Warranty/Liability
Should a Quick BASIC Renumber Utility disk fail due to defects in
materials or workmanship, it will be replaced at no charge. No
other representations or warranties are made, express or implied.
In no event shall Richard Z. Ward be liable for any direct,
indirect, consequential or incidental damages arising from the
use of the Quick BASIC Renumber Utility.
The Quick BASIC Renumber Utility Page 3
The Quick BASIC Renumber Utility -------------------------------
--------- Introduction
The Quick BASIC Renumber Utility (QBRENUM) has been designed to
renumber IBM and Microsoft BASIC source files compatible with the
QuickBASIC compilers (versions 1-4.5), the Business BASIC
compiler, and the BASICA and GWBASIC interpreters. QBRENUM
provides many useful features that are currently not supported by
most BASIC line renumbering programs.
First, QBRENUM can renumber all or just a section of your BASIC
source file. When renumbering a section, QBRENUM renumbers each
line found inside the section and makes the appropriate changes
to all references to the line in the source file.
Second, QBRENUM can renumber BASIC source files which use both
line labels and line numbers. QBRENUM recognizes line labels and
leaves them and all references to them intact.
Third, QBRENUM can renumber BASIC source files which have non-
ascending line numbers. QBRENUM can renumber each numbered line
to a new ascending order.
Fourth, QBRENUM can insert line numbers before non-numbered lines
of code. If your source file contains few or no line numbers,
inserting line numbers before non-numbered lines may help you
debug your program. Since many BASIC compilers reference the
last line number executed in their error messages, you may be
able to better identify which line of code is causing the problem
by inserting line numbers before all non-numbered lines.
Fifth, QBRENUM can remove line numbers from non-referenced lines
of code. You may find that having fewer line numbers makes your
source code easier to read and maintain. You may also wish to
remove non-referenced line numbers simply to determine if there
are any references to a particular line of code.
Sixth, QBRENUM can renumber all source files included by the
$INCLUDE metacommand. If your program includes other source
files using the $INCLUDE metacommand, QBRENUM will renumber the
primary source file and all of its include files at the same
time.
--------- On-line Instructions
To read the utility's short on-line instructions, type QBRENUM
with no command parameters. QBRENUM will display a brief
description of its functions and a summary of its command
parameters.
The Quick BASIC Renumber Utility Page 4
QBRENUM will also display a limited license agreement and a brief
message concerning the distribution of the program. For
information on how to register your copy of The QBRENUM utility,
read the User Support and Defects and Enhancements section of
this document.
It may be useful to send the on-line instructions to your
printer. Use the control-P output-to-printer function to do
this. The on-line instructions should provide you with a short
reference sheet.
--------- Getting Started
QBRENUM has a command line interface; it uses the command line to
determine the region of your source file to renumber. You are
expected to enter the new starting line number, the old starting
and old ending line number of the region, and the new line number
increment. The default values for these parameters specify an
entire source file.
The following is the basic form of the QBRENUM command line:
QBRENUM [pth [[newnum][,[fstnum][,[lstnum][,inc]]]] [/CIMRSTX]],
The "pth" argument specifies any legal BASIC source file
pathname. Note that QBRENUM requires that the source file be
saved in ASCII format.
The following are descriptions of the parameters which help
define the renumber-region:
newnum - This is the new starting line number. This
number replaces the first line number in
the renumber-region.
fstnum - This identifies the first number of the renumber-
region.
lstnum - This identifies the last number of the renumber-
region.
inc - This is the increment between successive line
numbers in the renumber-region.
The /CIMRSTX options are described below.
The Quick BASIC Renumber Utility Page 5
--------- Specifying Command Line Parameters
QBRENUM has default values for its parameters. The following is
a list of the parameter default values:
* newnum: 10
* fstnum: The first line of the file.
* lstnum: The last line of the file.
* inc: 10
If you do not specify any of these parameters on the command
line, QBRENUM will renumber your entire source file, using an
increment of ten and starting the numbering sequence with line
number ten.
If, however, you would like to specify some (but not all) of the
renumber region parameters on the command line, you must supply
comma delimeters up to your final parameter entry. For example,
to use all defaults except to specify an increment of 5 instead
of 10 on the command line, you must type:
QBRENUM TEST ,,,5
Or, to use all defaults except to specify line 50 as the first
line to be renumbered, you must type:
QBRENUM TEST ,50
The highest number that QBRENUM can identify from the command
line is 65535. When it encounters a number larger than 65535 on
the command line, QBRENUM displays an appropriate error message.
Please do NOT include commas in any number (i.e. 32,768).
--------- File Extensions
QBRENUM recognizes four file extensions: BAS, BAK, INC and MOD.
When no file extension is specified on the command line, QBRENUM
assumes the BAS extension.
The MOD file extension refers to a module or subprogram of any
main BASIC source file. This file extension makes it easier to
distinguish modules from main source files. For more information
about using BASIC modules, refer to The BASIC Source Merge
Utility (BASMER) instruction manual.
The Quick BASIC Renumber Utility Page 6
--------- An Example Run
For example, using the following section of the BASIC source file
TEST.BAS,
10 REM TEST PROGRAM
20 INPUT I: ON I GOTO 30,40
30 PRINT "1": GOTO 20
40 PRINT "2": GOTO 30
50 PRINT "3": GOTO 40
60 PRINT "4": GOTO 10
:
if you were to specify the following command line,
QBRENUM TEST 25,20,40,2
the QBRENUM renumber utility would create the file TEST.RNM;
TEST.RNM would appear as follows:
10 REM TEST PROGRAM
25 INPUT I: ON I GOTO 27,29
27 PRINT "1": GOTO 25
29 PRINT "2": GOTO 27
50 PRINT "3": GOTO 29
60 PRINT "4": GOTO 10
:
--------- The Output Files
In short, QBRENUM reads the specified source file, renumbers the
specified section of code and any included files, and saves all
newly renumbered versions to new output files. All output files
are given its corresponding input file's base name with a new
.RNM file extension. All renumbered versions of included source
files (using the $INCLUDE metacommand) are also given the new
file extension .RNM.
For example, the renumbered version of TEST.BAS is named
TEST.RNM.
QBRENUM does not change any input source file.
--------- Technical Points
QBRENUM's unique renumbering algorithm allows the utility to
quickly renumber extremely large source files, containing as many
as 65,535 lines. The utility's line length limits are large too:
QBRENUM will renumber source files containing lines with a
maximum length of 8,200 characters.
The Quick BASIC Renumber Utility Page 7
Since it was written entirely in ASSEMBLY language, QBRENUM will
renumber large source files very quickly. On an IBM AT, QBRENUM
renumbers source files of average complexity at a rate of about
72 physical lines of code per second.
The Quick BASIC Renumber Utility Page 8
The Quick BASIC Renumber Utility Options: /CIMRSTX -----
--------- Renumber Commented Lines Option /C
The Renumber Commented Lines option instructs QBRENUM to renumber
line references found in lines commented by REM or '. If you
have REMarked any lines of code, you will probably want to use
this option to maintain the correctness of all line references
found in commented lines of code.
The QBRENUM default is to ignore all line references found in REM
and ' statements.
--------- Insert Numbered Lines Option /I
The Insert option instructs QBRENUM to insert line numbers before
non-numbered lines of code. If, for example, your BASIC program
contains few line numbers, you may instruct QBRENUM to insert
line numbers in front of any or all non-numbered lines of code.
Note that if your BASIC program contains no line numbers, QBRENUM
can only insert line numbers in front of all lines of code. To
insert line numbers in a section of code, simply prefix the lines
that define the beginning and end of the section with token line
numbers. QBRENUM uses line numbers as reference points. In the
future, QBRENUM will use physical lines as well as line numbers
for reference points.
QBRENUM will not insert a line number before a line that begins
with an ASCII line label. In the future, the QBRENUM utility
will be able to exchange line labels for line numbers.
--------- Metacommand Preprocessing Option /M
The Metacommand preprocessing option instructs QBRENUM to search
the source files for the $INCLUDE metacommand and to renumber all
source files loaded by this compiler preprocessor instruction.
QBRENUM includes these source files before renumbering any code.
QBRENUM saves the renumbered code to new files, preserving all
base names and adding new .RNM file extensions.
The Quick BASIC Renumber Utility Page 9
QBRENUM recognizes the following metacommands, which may be
referenced in the QuickBASIC, Business Basic or IBM Basic
compiler manuals:
1) $DYNAMIC 6) $LINESIZE:n 10) $INCLUDE: '<file>'
2) $STATIC 7) $PAGESIZE:n 11) $TITLE: '<text>'
3) $PAGE 8) $PAGEIF:n 12) $SUBTITLE: '<text>'
4) $LIST{+/-} 9) $SKIP:n 13) $MODULE: '<file>'
5) $OCODE{+/-}
QBRENUM recognizes an $INCLUDE metacommand even when it follows
any number of the other twelve metacommands on a single line of
code. For example, QBRENUM can identify the $INCLUDE metacommand
in the following line of code:
100 REM $DYNAMIC $PAGESIZE: 66 $INCLUDE: 'test2' .
In this example, QBRENUM automatically suffixes the 'test2'
filename with the .BAS file extension and loads the new program
'test2.bas' module for renumbering.
Note that QBRENUM overwrites output files that have identical
corresponding input file basenames. So, make sure all $INCLUDE
file basenames are unique.
QBRENUM will not recognize an $INCLUDE metacommand which follows
a syntactically incorrect metacommand. When QBRENUM finds a
syntax error in a metacommand, it displays a brief error message
informing you of the physical line number where the metacommand
and the rest of the line were ignored. QBRENUM applies the same
syntactical rules as does the QuickBASIC, Business Basic and IBM
Basic compilers. For instance, QBRENUM ignores all code on the
same line following the $INCLUDE metacommand.
It is a good idea to remove all line numbers from an INCLUDE file
which is used by more than one source file. The newly renumbered
INCLUDE file may no longer be compatible with the numbering
scheme of one of the other source files.
--------- Relax Line Numbering Constraints Option /R
The Relax line numbering constraints option instructs QBRENUM to
ignore random line numbering schemes, and to allow you to
implement a new ascending-ordered numbering scheme. If, for
example, your BASIC programs contain line numbers sequenced in
non-ascending order, you will need to select this option to
renumber the lines.
QBRENUM does not preserve such line numbering schemes, and
renumbers such source files in ascending order.
The Quick BASIC Renumber Utility Page 10
Note that since QBRENUM sorts its line number tables before using
them, random line numbering schemes do not slow down its line
renumbering process. QBRENUM uses the "QuickSort" algorithm to
sort its tables.
--------- Strip Line Numbers from Non-Referenced Lines /S
The Strip line numbers option instructs QBRENUM to remove line
numbers from non-referenced lines of code. If, for example,
there are no line references in your source file, QBRENUM can
remove all line numbers.
Note that QBRENUM will remove non-referenced line numbers from
the renumber region only; QBRENUM leaves all lines of code
outside the specified renumber region intact.
--------- Take-out Extra Spaces After Line Numbers Option /T
The Take-out extra spaces option instructs QBRENUM to take out
all but one space and all tab characters found between the line
number and the BASIC code. This allows you to have QBRENUM left
justify your code.
--------- Exclude Renumbering the File Option /X
The Exclude Renumbering the file option instructs QBRENUM to not
renumber the specified region. As the only option specified, the
/X option renders the QBRENUM utility useful only as a line and
reference counter.
However, invoking the /X option with any of the other options
(/IMRST) allows you to insert line numbers, load $INCLUDEd source
files, or remove line numbers without having to renumber the
file. For example, for debugging purposes, you may insert line
numbers before non-numbered lines of code without disturbing the
existing line numbering scheme.
Or, to make the code more readable, you may have QBRENUM remove
line numbers from non-referenced lines of code without disturbing
other lines.
The Quick BASIC Renumber Utility Page 11
Important Characters and Technical Considerations --------------
--------- The Underline Line Extension Character
QBRENUM recognizes the underline character as a line extension
character. Thus, for example, QBRENUM will treat the following
three lines as one:
100 IF I = 1 THEN PRINT "YES"_
ELSE IF I = 2 THEN PRINT "NO"_
ELSE PRINT "MAYBE"
Please note that the maximum line length supported is 8,200
characters.
--------- Reserved Characters
QBRENUM uses certain reserved characters as markers to renumber
source files. These characters have ASCII values of zero (0),
twenty-six (26) and twenty-seven (27). Since most editors will
not allow you to enter such values, this should not pose any
problem. However, if your source file contains any of these
characters, QBRENUM will not run reliably.
--------- System Requirements
The following configuration is the minimum which is required to
gain access to all of the features of QBRENUM:
* IBM PC family member or Compatible w/128K
* One disk drive
* A monochrome or color display
* A printer
* PC/MS-DOS version 2.0 or later
--------- IBM Compatible Personal Computers
QBRENUM.COM has been written, assembled and tested on a standard
IBM PC. Since it relies mostly on MS-DOS interrupt routines,
QBRENUM should work well on any IBM compatible personal computer.
The Quick BASIC Renumber Utility Page 12
Trouble-shooting with the QBRENUM error messages ---------------
The following list contains most of the error messages that are
displayed during the execution of the QBRENUM utility. Each
error message is followed by a brief description of some of its
possible causes.
Error 1: Renumber region has been illegally defined
QBRENUM was unable to work with the region defined on the command
line. Specify the /R option to override this check.
Error 2: Starting line number is too small
The new starting line number entered on the command line was too
small: it forced QBRENUM to assign new line numbers in
non-ascending order. If this is the desired result, specify the
/R option on the command line.
Error 3: Starting line number is too large
The new starting line number entered on the command line was too
large: it forced QBRENUM to assign new line numbers in
non-ascending order. If this is the desired result, specify the
/R option on the command line.
Error 4: Line number on Pxxxx is too large (max=65535; 32767 /S)
QBRENUM encountered a line number or line reference greater than
65,535 in the source file. No output file was created. QBRENUM
will not renumber a file that contains such large line numbers.
Error 5: Line increment is too large
The new line numbering overlapped with lines of code not in the
renumber section. QBRENUM created no output files. Specify a
smaller increment.
Error 6: Beginning line number of renumber region not found
If you selected the /R option, QBRENUM searched the source files
for the specified starting line number. Otherwise, the utility
searched for the first line number greater than or equal to the
the specified starting line number. If your program makes little
or no use of line numbers, insert a few at the beginning and end
of the section you want to renumber.
The Quick BASIC Renumber Utility Page 13
Error 7: Undefined line reference on line xxxx
QBRENUM encountered a line reference that was not defined in its
tables. As a result, the utility left a marker in front of the
undefined line number in the output file. QBRENUM leaves a '<u>'
marker.
Error 8: Not enough memory
There was not enough available memory for QBRENUM to renumber
even the smallest source file. QBRENUM requires approximately
32k of memory to renumber a one-line source file.
Error 9: Not enough memory for renumber region
QBRENUM could not store any more entries in its line number
tables in memory. If the utility runs with less than 96k of
available memory, then it may need more memory. Otherwise, the
file may be too large for QBRENUM. The utility creates line
number tables containing as many as 16,383 different entries.
Error 10: Disk full/Unable to Write to file
QBRENUM closed all files and stopped execution. Clear more space
on the disk for the output files.
Error 11: Numbering on line xxxx is out of sequence
Physical line number xxxx contains a line number that breaks the
ascending order. QBRENUM will not renumber this file unless you
instruct it to ignore the numbering scheme with the /R option.
Error 12: Unable to open include file <filename>
QBRENUM could not find or open an include file referenced by an
$INCLUDE metacommand. If your program has your compiler load
many include files, use the FILES=20 command in your CONFIG.SYS
file. Then, reboot your computer. Otherwise, check the current
directory for the file. QBRENUM created no output files.
Error 13: Unable to create output file <filename>
Check the space left on the disk. If you are using a floppy
disk, also check the write-protect tab.
The Quick BASIC Renumber Utility Page 14
Error 14: Unable to read from include file <filename>
Check the default disk drive. It may be open.
Error 15: Unable to move file pointer in <filename>
Check the default disk drive. It may be open.
Error 16: Line Pxxxxx is too long (max = 8200 bytes)
QBRENUM encountered a line more than than 8,200 bytes long.
Since it reads source input files in blocks of 8,200 bytes,
QBRENUM is unable to renumber files containing lines of such
lengths. Shorten the line before re-invoking QBRENUM.
Error 17: Incorrect DOS version
QBRENUM operates under MS-DOS versions 2.0 or later. It does not
support earlier versions of DOS.
Error 18: File must have .BAS, .BAK or .MOD extension
Because QBRENUM works exclusively on BASIC source files, only
those files with typical BASIC source file extensions are allowed
to be specified on the command line.
Error 19: Syntax Error in command line
QBRENUM was unable to process the command line. Reread the
utility's short on-line instructions.
Error 20: File not found
QBRENUM could not find the source file in the specified directory
path.
Error 22: Number too large on command line (Max=65535)
QBRENUM encountered a number larger than 65,535 on the command
line. No output file was created.
The Quick BASIC Renumber Utility Page 15
BASIC Commands Supported by the Basic Renumber Utility ---------
QBRENUM supports the following BASIC commands that deal directly
and indirectly with line numbers. If there are any other or
special commands not listed here, write me at the address shown
above. I will try to include them in a next version.
AUTO [number[,increment]]
CHAIN [MERGE] filespec[,[line][,ALL][,DELETE range]]]
DELETE [line1][-line2]
DELETE [line1-]
EDIT line
IF ERL = line number THEN... (not) IF line number = ERL
GOSUB line
GOTO line
IF expression [,]THEN clause[ELSE clause]
IF expression [,]GOTO line[[,]ELSE clause]
LIST [line1][-line2]][,filespec]
LLIST [line1][-[line2]
ON COM(n) GOSUB line
ON ERROR GOTO line
ON n GOTO line[,line]...
ON n GOSUB line[,line]...
ON KEY(n) GOSUB line
ON PEN GOSUB line
ON PLAY(n) GOSUB line
ON STRIG(n) GOSUB line
ON TIMER(n) GOSUB line
RENUM [newnum][,[oldnum][,increment]]
RESTORE [line]
RESUME line
RETURN [line]
RUN [line]
QBRENUM also supports the following BASIC comment and data
commands:
REM
'
DATA
COMMON SHARED
QBRENUM also recognizes the following BASIC metacommands:
$DYNAMIC $LINESIZE:n $INCLUDE: '<file>'
$STATIC $PAGESIZE:n $TITLE: '<text>'
$PAGE $PAGEIF:n $SUBTITLE: '<text>'
$LIST{+/-} $SKIP:n $MODULE: '<file>'
$OCODE{+/-}
The Quick BASIC Renumber Utility Page 16